import request from "@/utils/request";
import { AxiosPromise } from 'axios';
import { AllocationForm, AllocationQuery ,} from "@/api/collect/allocation/types";
import { ExpenseFinalVO, ExpenseFinalForm, ExpenseFinalQuery } from "@/api/collect/execute/expense/types";

/**
 * 费用类数据列表
 * @param data
 * @returns
 */
export const listAllocationFinal = (data?: AllocationQuery) => {
  return request({
    url: "/collect/dataExpenseFinal/listPage",
    method: "post",
    data: data
  });
};

/**
 * 费用类数据总计
 * @param data
 * @returns
 */
export const totalProperty = (data?: AllocationQuery) => {
  return request({
    url: "/collect/dataExpenseFinal/getTotal",
    method: "post",
    data: data
  });
};

/**
 * 分配数据（费用类数据）
 * @param dto
 */
export const allocation = (dto: AllocationForm) => {
  return request({
    url: "/collect/dataExpenseFinal/allot",
    method: "post",
    data: dto
  });
};
/**
 * 撤销数据分配（费用类数据）
 * @param id
 */
export const withdraw = (id: string | number) => {
  return request({
    url: "/collect/dataExpenseFinal/withdraw/" + id,
    method: "get",
    params: id
  });
};
/**
 * 查询费用类数据详细
 * @param id
 */
export const getExpenseFinal = (id: string | number): AxiosPromise<ExpenseFinalVO> => {
  return request({
    url: '/collect/dataExpenseFinal/' + id,
    method: 'get'
  });
};
/**
 * 新增费用类数据
 * @param data
 */
export const addExpenseFinal = (data: ExpenseFinalForm) => {
  return request({
    url: '/collect/dataExpenseFinal/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改费用类数据
 * @param data
 */
export const updateExpenseFinal = (data: ExpenseFinalForm) => {
  return request({
    url: '/collect/dataExpenseFinal/edit',
    method: 'put',
    data: data
  });
};

/**
 * 删除费用类数据
 * @param id
 */
export const delExpenseFinal = (id: string | number | Array<string | number>) => {
  return request({
    url: '/collect/dataExpenseFinal/' + id,
    method: 'delete'
  });
};
